﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	 xmlns:local="clr-namespace:SQLServerOptimizer.PL.WPF"
	 
	mc:Ignorable="d"
	x:Class="SQLServerOptimizer.PL.WPF.SchedulingControl"
	x:Name="This"
	>
    <UserControl.Resources>
        <local:ErrorsToMessageConverter x:Key="eToMConverter" />
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <StackPanel d:LayoutOverrides="Width, Height" Margin="0,0,0,0">
            <StackPanel Orientation="Horizontal">
                <Label  Content="Start time:"  FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBox x:Name="textboxtime"   TextWrapping="Wrap" FontSize="15" VerticalAlignment="Center" >
                    <TextBox.Text>
                        <Binding ElementName="This" Path="timech" 
                UpdateSourceTrigger="PropertyChanged">
                            <Binding.ValidationRules>
                                <local:ValidateTime/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <Label Margin="2,0" Foreground="Red"  FontSize="15"
              Content="{Binding ElementName=textboxtime, 
                             Path=(Validation.Errors),
                             Converter={StaticResource eToMConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center" />
            </StackPanel>
            <Label Content="Recurrence pattern" FontSize="15"/>
            <StackPanel Orientation="Horizontal">
                <StackPanel VerticalAlignment="Bottom">
                    <RadioButton FontSize="15" x:Name="rbDaily" Content="Daily" Margin="0,0,11,0" d:LayoutOverrides="Width" IsChecked="True" Checked="rbDaily_Checked" />
                    <RadioButton FontSize="15" x:Name="rbWeekly" Content="Weekly" Margin="0,0,11,0" d:LayoutOverrides="Width" Checked="rbWeekly_Checked" />
                    <RadioButton FontSize="15" x:Name="rbMonthly" Content="Monthly" Margin="0,0,11,0" d:LayoutOverrides="Width" Checked="rbMonthly_Checked" />
                </StackPanel>
                <Grid d:LayoutOverrides="HorizontalAlignment">
                    <StackPanel x:Name="spDaily" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0">
                        <RadioButton FontSize="15" x:Name="rbEverynumberofdays" IsChecked="True">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock FontSize="15" TextWrapping="Wrap" Text="Every" VerticalAlignment="Center"/>
                                <TextBox FontSize="15" x:Name="tbxNumberOfDays" TextWrapping="Wrap" Text="1" Margin="10,0"/>
                                <TextBlock FontSize="15" TextWrapping="Wrap" VerticalAlignment="Center"><Run Text="day(s)"/></TextBlock>
                            </StackPanel>
                        </RadioButton>
                        <RadioButton FontSize="15" x:Name="rbEveryWeekDay" Content="Every weekday"/>
                    </StackPanel>
                    <StackPanel x:Name="spWeekly" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0" Visibility="Hidden">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock  FontSize="15" TextWrapping="Wrap" VerticalAlignment="Center" FontFamily="Segoe UI" ><Run Text="Recur every"/></TextBlock>
                            <TextBox x:Name="weeklyInterval" FontSize="15" TextWrapping="Wrap" Text="1" Margin="10,0" VerticalAlignment="Center"/>
                            <TextBlock FontSize="15" TextWrapping="Wrap" VerticalAlignment="Center"  Foreground="Black"><Run Text="week(s) on:"/></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="10,0,0,0">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="10" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="10" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="10" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <CheckBox FontSize="15" x:Name="chbxMonday" Grid.Column="0" Content="Monday" Margin="0" d:LayoutOverrides="Height" HorizontalAlignment="Left"/>
                                <CheckBox FontSize="15" x:Name="chbxTuesday" Grid.Column="2" Content="Tuesday" Margin="0,0,0,0" d:LayoutOverrides="Height" HorizontalAlignment="Left"/>
                                <CheckBox FontSize="15" x:Name="chbxWednesday" Grid.Column="4" Content="Wednesday" HorizontalAlignment="Left" Margin="0,0,0,0" d:LayoutOverrides="Height"/>
                                <CheckBox FontSize="15" x:Name="chbxThursday" Grid.Column="7" Content="Thursday" HorizontalAlignment="Left" Margin="0,0,0,0" d:LayoutOverrides="Height"/>
                                <CheckBox FontSize="15" x:Name="chbxFriday" Grid.Column="0" Grid.Row="1" Content="Friday" Margin="0,0,0,0" d:LayoutOverrides="Width, Height" HorizontalAlignment="Left"/>
                                <CheckBox FontSize="15" x:Name="chbxSaturday" Grid.Column="2"  Grid.Row="1" Content="Saturday"  Margin="0" d:LayoutOverrides="Width, Height" HorizontalAlignment="Left"/>
                                <CheckBox FontSize="15" x:Name="chbxSunday" Grid.Column="4" Grid.Row="1" Content="Sunday" HorizontalContentAlignment="Center"  Margin="0" d:LayoutOverrides="Width, Height" HorizontalAlignment="Left"/>
                            </Grid>
                        </StackPanel>
                    </StackPanel>
                    <StackPanel x:Name="spMonthly" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Center" Visibility="Hidden">
                        <RadioButton FontSize="15" x:Name="rbEverynumberofdayinmonth" IsChecked="True">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock TextWrapping="Wrap" VerticalAlignment="Center"><Run Language="nl-nl" Text="Day"/></TextBlock>
                                <TextBox x:Name="tbxNumberOfDay" TextWrapping="Wrap" Text="1" Margin="10,0"/>
                                <TextBlock TextWrapping="Wrap" VerticalAlignment="Center"><Run Language="nl-nl" Text="of every month"/></TextBlock>
                            </StackPanel>
                        </RadioButton>
                        <RadioButton FontSize="15" x:Name="rbTheDayinMonth">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock TextWrapping="Wrap" VerticalAlignment="Center"><Run Language="nl-nl" Text="The"/></TextBlock>
                                <ComboBox x:Name="daysofweekbox" FontSize="15" Margin="10,0,5,0" SelectedIndex="0">
                                    <ComboBoxItem Content="first"/>
                                    <ComboBoxItem Content="second"/>
                                    <ComboBoxItem Content="third"/>
                                    <ComboBoxItem Content="fourth"/>
                                    <ComboBoxItem Content="last"/>
                                </ComboBox>
                                <ComboBox x:Name="dayssbox" FontSize="15" Margin="5,0,10,0" SelectedIndex="0">
                                    <ComboBoxItem Content="day"/>
                                    <ComboBoxItem Content="Monday"/>
                                    <ComboBoxItem Content="Tuesday"/>
                                    <ComboBoxItem Content="Wednesday"/>
                                    <ComboBoxItem Content="Thursday"/>


                                    <ComboBoxItem Content="friday"/>
                                    <ComboBoxItem Content="Saturday"/>
                                    <ComboBoxItem Content="Sunday"/>
                                </ComboBox>
                                <TextBlock FontSize="15" TextWrapping="Wrap" VerticalAlignment="Center"><Run Text="of every"/><Run Language="nl-nl" Text=" month"/></TextBlock>
                            </StackPanel>
                        </RadioButton>
                    </StackPanel>
                </Grid>
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>